from django.contrib import admin
from hosting.ftp.models import FTPUser, get_folder_list
from django.forms import ModelForm, BaseModelForm
from django import forms

class FTPAdminForm(ModelForm):
    directory = forms.ChoiceField()

    def __init__(self, *args, **kwargs):
       super(FTPAdminForm, self).__init__(*args, **kwargs)
       self.fields['directory'].choices = get_folder_list()

class FTPAdmin(admin.ModelAdmin):
    form = FTPAdminForm


admin.site.register(FTPUser, FTPAdmin)
